// 文件名: src/api/modules/reservation.ts
// 块功能: 预约单管理 (Reservations) 模块 API
// 描述: 包含预约单的查询和管理接口。

import service from '../request'
import type { PageResponse } from '../types/common'
import type { ReservationDetail, ReservationListParams } from '../types/reservation'

/**
 * @功能: 分页筛选预约单
 * @param params 查询参数
 */
export const getReservationListApi = (
  params: ReservationListParams,
): Promise<PageResponse<ReservationDetail>> => {
  return service.get('/api/admin/orders/reservations/', { params })
}

/**
 * @功能: 管理员取消预约
 * @param id 预约单 ID
 */
export const cancelReservationApi = (id: number): Promise<ReservationDetail> => {
  return service.patch(`/api/admin/orders/reservations/${id}/cancel`)
}
